import React, { useState } from "react";
import { Button, Input } from "antd";

function MyInput({ onClick }) {
  const [inputVal, setInputVal] = useState("");

  const handleSearch = () => {
    if (onClick) {
      onClick(inputVal);
    }
  };

  return (
    <div>
      <Input
        placeholder="请输入资源名称..."
        value={inputVal}
        style={{ width: 200, height: 32, marginLeft: 20 }}
        onChange={(e) => setInputVal(e.target.value)}
      />
      <Button
        type="primary"
        style={{ width: 50, height: 32, marginLeft: 20 }}
        onClick={handleSearch}
      >
        搜索
      </Button>
    </div>
  );
}

export default MyInput;
